PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPTerminateTask

Terminates an existing task.

OSStatus MPTerminateTask (
                     MPTaskID task,
                     OSStatus terminationStatus);
task
A value of type MPTaskID that specifies the ID of the task you wish to terminate.
terminationStatus
A 32-bit value of type OSStatus indicating termination status. This value is sent to the termination status message queue you specified in MPCreateTask in place of the task function's result code.
function result
A result code. See Result Codes for a list of possible values. If the task to be terminated is already in the process of termination, MPTerminateTask returns kMPInsufficientResourcesErr . You do not need to take any additional action if this occurs.
DISCUSSION

You should not assume that the task has completed termination when this call returns; the proper way to synchronize with task termination is to wait on the termination queue (specified in MPCreateTask ) until a message appears. Because task termination is a multistage activity, it is possible for a preemptive task to attempt to terminate a task that is already undergoing termination. In such cases, MPTerminateTask returns kMPInsufficientResourcesErr .

Note that Multiprocessing Services resources (event groups, queues, semaphores, and critical regions) owned by a preemptive task are not released when that task terminates. If a task has a critical region locked when it terminates, the critical region remains in the locked state. Multiprocessing Services resources no longer needed should be explicitly deleted by the task that handles the termination message. All Multiprocessing Services resources created by tasks are released when their owning process (that is, the host application) terminates.

VERSION NOTES

Introduced with Multiprocessing Services 1.0.


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)